<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            width: 100%;
            height: 100%;
        }
        body{
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .box{
            width: 80%;
            height: 80%;
        }
        ul{
            list-style: none;
            display: flex;
        }
        .tabs{
            height: 20%;
            width: 100%;
        }
        .tabs>li{
            width: 25%;
            box-sizing: border-box;
            height: 100%;
            border: 2px solid black;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 40px;
        }
        .content{
            position: relative;
            width: 100%;
            height: 80%;
            border: 2px solid black;
            box-sizing: border-box;
        }
        .content>li{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            text-align: center;
            font-size: 100px;
            background-color: yellowgreen;
            display: none;
        }
        .active{
            background-color: yellowgreen;
        }
        .content>.active2{
            display: block;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul class="tabs">
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
        <ul class="content">
            <li class="active2">1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
    </div>
    <script>
        const tabs = document.querySelectorAll('.tabs>li')
        const content = document.querySelectorAll('.content>li')

        for(let i = 0;i<tabs.length;i++){
            tabs[i].onclick = ()=>{
                tabs.forEach(item=>item.classList.remove('active'))
                tabs[i].classList.add('active')
                content.forEach(item=>item.classList.remove('active2'))
                content[i].classList.add('active2')
            }
        }
    </script>
</body>
</html>